microcad-lang-parse 0.5.0

µcad language syntax lexer and parser
Documentation
---
source: crates/syntax/tests/parser.rs
expression: parse(input)
---
Ok(
    Program {
        span: 0..9,
        statements: StatementList {
            span: 0..9,
            extras: ItemExtras {
                leading: LeadingExtras(
                    [],
                ),
                trailing: TrailingExtras(
                    [],
                ),
            },
            statements: [],
            tail: Some(
                ExpressionStatement {
                    span: 0..9,
                    extras: ItemExtras {
                        leading: LeadingExtras(
                            [],
                        ),
                        trailing: TrailingExtras(
                            [],
                        ),
                    },
                    attributes: [],
                    expression: BinaryOperation(
                        BinaryOperation {
                            span: 0..9,
                            lhs: BinaryOperation(
                                BinaryOperation {
                                    span: 0..7,
                                    lhs: Bracketed(
                                        BinaryOperation(
                                            BinaryOperation {
                                                span: 1..4,
                                                lhs: Literal(
                                                    Literal {
                                                        span: 1..2,
                                                        extras: ItemExtras {
                                                            leading: LeadingExtras(
                                                                [],
                                                            ),
                                                            trailing: TrailingExtras(
                                                                [],
                                                            ),
                                                        },
                                                        literal: Integer(
                                                            IntegerLiteral {
                                                                span: 1..2,
                                                                value: 1,
                                                                raw: "1",
                                                            },
                                                        ),
                                                    },
                                                ),
                                                operation: BinaryOperator {
                                                    span: 2..3,
                                                    operation: Add,
                                                },
                                                rhs: Literal(
                                                    Literal {
                                                        span: 3..4,
                                                        extras: ItemExtras {
                                                            leading: LeadingExtras(
                                                                [],
                                                            ),
                                                            trailing: TrailingExtras(
                                                                [],
                                                            ),
                                                        },
                                                        literal: Integer(
                                                            IntegerLiteral {
                                                                span: 3..4,
                                                                value: 2,
                                                                raw: "2",
                                                            },
                                                        ),
                                                    },
                                                ),
                                            },
                                        ),
                                        0..5,
                                    ),
                                    operation: BinaryOperator {
                                        span: 5..6,
                                        operation: Multiply,
                                    },
                                    rhs: Literal(
                                        Literal {
                                            span: 6..7,
                                            extras: ItemExtras {
                                                leading: LeadingExtras(
                                                    [],
                                                ),
                                                trailing: TrailingExtras(
                                                    [],
                                                ),
                                            },
                                            literal: Integer(
                                                IntegerLiteral {
                                                    span: 6..7,
                                                    value: 3,
                                                    raw: "3",
                                                },
                                            ),
                                        },
                                    ),
                                },
                            ),
                            operation: BinaryOperator {
                                span: 7..8,
                                operation: Add,
                            },
                            rhs: Literal(
                                Literal {
                                    span: 8..9,
                                    extras: ItemExtras {
                                        leading: LeadingExtras(
                                            [],
                                        ),
                                        trailing: TrailingExtras(
                                            [],
                                        ),
                                    },
                                    literal: Integer(
                                        IntegerLiteral {
                                            span: 8..9,
                                            value: 1,
                                            raw: "1",
                                        },
                                    ),
                                },
                            ),
                        },
                    ),
                },
            ),
        },
    },
)